package com.ruoyi.oc.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.oc.mapper.SalesOrderMapper;
import com.ruoyi.oc.domain.SalesOrder;
import com.ruoyi.oc.service.ISalesOrderService;
import com.ruoyi.common.core.text.Convert;

/**
 * 销售订单主Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-18
 */
@Service
public class SalesOrderServiceImpl implements ISalesOrderService 
{
    @Autowired
    private SalesOrderMapper salesOrderMapper;

    /**
     * 查询销售订单主
     * 
     * @param orderId 销售订单主主键
     * @return 销售订单主
     */
    @Override
    public SalesOrder selectSalesOrderByOrderId(String orderId)
    {
        return salesOrderMapper.selectSalesOrderByOrderId(orderId);
    }

    /**
     * 查询销售订单主列表
     * 
     * @param salesOrder 销售订单主
     * @return 销售订单主
     */
    @Override
    public List<SalesOrder> selectSalesOrderList(SalesOrder salesOrder)
    {
        return salesOrderMapper.selectSalesOrderList(salesOrder);
    }

    /**
     * 新增销售订单主
     * 
     * @param salesOrder 销售订单主
     * @return 结果
     */
    @Override
    public int insertSalesOrder(SalesOrder salesOrder)
    {
        salesOrder.setCreateTime(DateUtils.getNowDate());
        return salesOrderMapper.insertSalesOrder(salesOrder);
    }

    /**
     * 修改销售订单主
     * 
     * @param salesOrder 销售订单主
     * @return 结果
     */
    @Override
    public int updateSalesOrder(SalesOrder salesOrder)
    {
        salesOrder.setUpdateTime(DateUtils.getNowDate());
        return salesOrderMapper.updateSalesOrder(salesOrder);
    }

    /**
     * 批量删除销售订单主
     * 
     * @param orderIds 需要删除的销售订单主主键
     * @return 结果
     */
    @Override
    public int deleteSalesOrderByOrderIds(String orderIds)
    {
        return salesOrderMapper.deleteSalesOrderByOrderIds(Convert.toStrArray(orderIds));
    }

    /**
     * 删除销售订单主信息
     * 
     * @param orderId 销售订单主主键
     * @return 结果
     */
    @Override
    public int deleteSalesOrderByOrderId(String orderId)
    {
        return salesOrderMapper.deleteSalesOrderByOrderId(orderId);
    }
}
